package com.heima.admin.controller.v1;

import com.heima.admin.service.NewsAuthService;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/v1/news")
@Slf4j
public class NewsAuthController {

    @Autowired
    private NewsAuthService newsAuthService;

    /**
     * 查询列表
     *
     * @param dto
     * @return
     */
    @PostMapping("/list_vo")
    public ResponseResult newListVos(@RequestBody NewsAuthDto dto) {
//        log.info("页面传参---：{}",dto);
        return newsAuthService.newListVo(dto);
//        return  null;
    }

    /**
     * 查询文章详情
     */
    @GetMapping("/one_vo/{id}")
    public ResponseResult oneVoById(@PathVariable("id") Integer wmNewsId){
        return newsAuthService.oneVoById(wmNewsId);
    }

    /**
     * 审核成功
     * @param dto
     * @return
     */
    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto){

        return newsAuthService.authPass(dto);
    }

    /**
     * 审核失败
     * @param dto
     * @return
     */
    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto dto){
        return newsAuthService.authFail(dto);
    }


}
